import json



whole_width = 5670
whole_height = 4607

ratio = whole_width / whole_height
print(f"--------ratio: {ratio}")

all_area_data = list()
all_area_res = list()

all_area_data.append(dict(id=1, x=1795, y= 256, w= 722, h= 477))
all_area_data.append(dict(id=2, x=2517, y= 256, w= 722, h= 477))
all_area_data.append(dict(id=3, x=3239, y= 256, w= 722, h= 477))
all_area_data.append(dict(id=4, x=130 , y= 850, w= 520, h= 800))
all_area_data.append(dict(id=5, x=800 , y= 850, w= 520, h= 800))
all_area_data.append(dict(id=6, x=1477 , y= 850, w= 520, h= 800))
all_area_data.append(dict(id=7, x=2037, y= 740,	w= 796, h= 473))
all_area_data.append(dict(id=8, x=2844, y= 740,	w= 796, h= 473))
all_area_data.append(dict(id=9, x=3674 , y= 850, w= 520, h= 800))
all_area_data.append(dict(id=10, x=4344 , y= 850, w= 520, h= 800))
all_area_data.append(dict(id=11, x=5020 , y= 850, w= 520, h= 800))
all_area_data.append(dict(id=12, x=2037, y= 1232,	w= 796, h= 473))
all_area_data.append(dict(id=13,x=2844, y= 1232,	w= 796, h= 473))
all_area_data.append(dict(id=14, x=1658 , y= 1787, w= 1080, h=890))
all_area_data.append(dict(id=15, x=2948 , y= 1787, w= 1080, h=890))
all_area_data.append(dict(id=16, x=1658 , y= 2676, w= 1080, h=890))
all_area_data.append(dict(id=17, x=2948 , y= 2676, w= 1080, h=890))
all_area_data.append(dict(id=18, x=1658 , y= 3555, w= 1080, h=890))
all_area_data.append(dict(id=19, x=2948 , y= 3555, w= 1080, h=890))

def calc():
    for area in all_area_data:
        x = round((area['x'] / whole_width), 5)
        y = round((area['y'] / whole_height), 5)
        w = round((area['w'] / whole_width), 5)
        h = round((area['h'] / whole_height), 5)

        area_res = dict(id=area['id'], x=x , y= y, w= w, h=h)
        print(f"{json.dumps(area_res)}")
        all_area_res.append(area_res)

calc()
print(f"--------------------------------------------------------")
print(f"--------------------------------------------------------")
print(f"--------------------------------------------------------")
print(all_area_res)